package vn.smartoffice.promail.controller;

import org.zkoss.bind.annotation.Command;
import org.zkoss.zk.ui.Page;
import org.zkoss.zk.ui.select.Selectors;
import org.zkoss.zk.ui.select.annotation.VariableResolver;
import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zkplus.spring.DelegatingVariableResolver;
import org.zkoss.zul.Include;

@VariableResolver(DelegatingVariableResolver.class)
public class LeftPanelCtr {

	@WireVariable
	private Page page;

	@Command("onTbMailClick")
	public void onTbMailClick() {
		getInclude().setSrc("mail.zul");
	}

	@Command("onTbContactClick")
	public void onTbContactClick() {
		getInclude().setSrc("mailContact.zul");
	}

	@Command("onTbCalendarClick")
	public void onTbCalendarClick() {
		getInclude().setSrc("/calendar/zk_calendar.zul");
	}

	@Command("onTbNoteClick")
	public void onTbNoteClick() {
		getInclude().setSrc("mailNote.zul");
	}

	@Command("onTbFileClick")
	public void onTbFileClick() {
		getInclude().setSrc("mailFile.zul");
	}

	private Include getInclude() {
		return (Include) Selectors.iterable(page, "#mainContent").iterator().next();
	}
}
